Video decoder with constrained dynamic range

ABSTRACT

A decoder that decodes video receives a bitstream containing quantized coefficient level values representative of a block of video representative of a plurality of pixels and a quantization parameter related to the block of video. A de-quantizer of the decoder de-quantizing the quantized coefficient level values based upon the quantized coefficient level values, the quantization parameter, and a weighting matrix. The decoder inverse transforming the dequantized coefficients to determine a decoded residue, where the quantized coefficient level values provided to the de-quantizer do not contain data that results in any quantized element level value that exceeds the range of integer values from −2 15−QP/6  to 2 15−QP/6 −1, inclusive.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation-in-part of U.S. patent application Ser. No. 13/303,025, filed Nov. 22, 2011, which is a continuation-in-part of U.S. patent application Ser. No. 13/298,771, filed Nov. 17, 2011, which is a continuation-in-part of U.S. patent application Ser. No. 13/291,004, filed Nov. 7, 2011.

BACKGROUND OF THE INVENTION

The present invention relates to image decoding with dynamic range constraints.

Existing video coding standards, such as H.264/AVC, generally provide relatively high coding efficiency at the expense of increased computational complexity. As the computational complexity increases, the encoding and/or decoding speeds tend to decrease. Also, the desire for increased higher fidelity tends to increase over time which tends to require increasingly larger memory requirements, increasingly larger memory bandwidth requirements, and increasing hardware complexity. The increasing memory requirements and the increasing memory bandwidth requirements tends to result in increasingly more expensive and computationally complex circuitry, especially in the case of embedded systems.

Referring to FIG. 1, many decoders (and encoders) receive (and encoders provide) encoded data for blocks of an image. Typically, the image is divided into blocks and each of the blocks is encoded in some manner, such as using a discrete cosine transform (DCT), and provided to the decoder. The decoder receives the encoded blocks and decodes each of the blocks in some manner, such as using an inverse discrete cosine transform. In many cases, the decoding of the image coefficients of the image block is accomplished by matrix multiplication. The matrix multiplication may be performed for a horizontal direction and the matrix multiplication may be performed for a vertical direction. By way of example, for 8-bit values, the first matrix multiplication can result in 16-bit values, and the second matrix multiplication can result in 24-bit values in some cases. In addition, the encoding of each block of the image is typically quantized, which maps the values of the encoding to a smaller set of quantized coefficients. Quantization requires de-quantization by the decoder, which maps the set of quantized coefficients to approximate encoding values or de-quantized coefficients. The number of desirable bits for de-quantized coefficients is a design parameter. The potential for large de-quantized coefficient values resulting from the matrix multiplication and the de-quantization operation is problematic for resource constrained systems, especially embedded systems.

The foregoing and other objectives, features, and advantages of the invention will be more readily understood upon consideration of the following detailed description of the invention, taken in conjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 illustrates an encoder and a decoder.

FIG. 2 illustrates a decoder with a de-quantizer and an inverse transform.

FIG. 3 illustrates another decoder with a de-quantizer and an inverse transform.

FIG. 4 illustrates a set of equations.

FIG. 5 illustrates a decoder with a de-quantizer and an inverse transform.

FIG. 6 illustrates a process flow for a decoder.

FIG. 7 illustrates a clipping process.

FIG. 8 illustrates another dequantization process.

FIG. 9 illustrates another dequantization process.

FIG. 10 illustrates another dequantization process.

FIG. 11 illustrates another dequantization process.

FIG. 12 illustrates another dequantization process.

FIG. 13 illustrates another dequantization process.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENT

Referring to FIG. 2, an exemplary decoder for the de-quantization and inverse transformation of the received quantized coefficients from the encoder for a block of the image is illustrated, in relevant part. The decoder receives the quantized coefficient level value 200 at a de-quantizer 210. The de-quantized coefficients resulting from the de-quantizer 210 are stored in memory 220. The de-quantized coefficients stored in memory 220 are then processed by a pair of inverse transforms 230 to determine a decoded residue 310. The pair of inverse transforms map data from a transform domain to a spatial domain using a matrix multiplication operator or other suitable process.

The de-quantizer 210 includes a descaling process 240. The descaling process 240 maps quantized coefficient level values 200 that are transmitted in the bitstream. The descaling process corresponds to multiplying quantized coefficient level values with one integer number dependent on quantization parameter (QP), coefficient index, and transform size (N). An example of the descaling process 240 may include Level*IntegerValue (Remainder, coefficient index)*16 for a de-quantizer used prior to an 8×8 inverse transform and Level*IntegerValue (Remainder, coefficient index) for a de-quantizer used prior to other transform sizes, where Level denotes the quantized coefficient level value, IntegerValue is the integer number. The descaling process 240 is preferably based upon a function of a remainder, transform size, and/or a coefficient index (e.g., position), to determine an intermediate set of values 250. The remainder is the sum of the quantization parameter (QP)+P*BitIncrement modulo P ((QP+P*BitIncrement) % P). Modulo as defined in the H.264/AVC standard is defined as: x % y, as remainder of x divided by y, defined only for integers x and y with x>=0 and y>0. In one embodiment P may take on the value 6. An adjustment mechanism A 260 may be applied to the values 250, which may be a variable dependent on transform size and/or a function of a received Period. The period is the sum of the quantization parameter (QP)+P*BitIncrement divided by P ((QP+P*BitIncrement)/P), where “BitIncrement” is the bit depth increment. The “/” as defined in the H.264/AVC standard is defined as: integer division with truncation of the result towards zero. For example, 7/4 and −7/−4 are truncated to 1 and −7/4 and 7/−4 are truncated to −1. In one embodiment P may take on the value 6. The resulting values 250, possibly further modified by mechanism A 260, may be further modified by a factor of 2^((Period+B)) 270. B is a variable that is dependent on the transform size. The results of the modification 270 are de-quantized coefficient values and stored in the memory 220. The inverse transformation 230 may perform a 1-dimensional inverse horizontal transform 280, which is stored in memory 290. The inverse transform 230 may also perform a 1-dimensional inverse vertical transform 300, which results in the decoded residue 310. The transforms 280 and 300 may be swapped with each other, as desired.

The memory bandwidth of the memory storage 220 the video decoder illustrated in FIG. 2, when implemented within the “Part 10: Advanced Video Coding”, ISO publication: ISO/IEC 14496-10: 2005—Information Technology—Coding Of Audio-Visual Objects (incorporated by reference herein) (H.264/AVC standard), may be limited by using a constraint. For example, in section 8.5.10 of the H.264/AVC standard, the width of the memory access for 4×4 luma DC transform coefficients is limited by including the following statements: “The bitstream shall not contain data that result in any element f_(ij) of f with i, j=0 . . . 3 that exceeds the range of integer values from −2^((7+bitDepth)) to 2^(7+bitDepth))−1, inclusive” and “The bitstream shall not contain data that result in any element dcY_(ij) of dcY with i, j=0 . . . 3 that exceeds the range of integer values from −2^((7+bitDepth)) to 2^((7+bitDepth))−1, inclusive.” The H.264/AVC standard includes similar memory limitation for other transform sizes. In addition to including a complex memory bandwidth limitation, the H.264/AVC standard includes no mechanism to ensure that this limitation is enforced. Similarly, the JCT-VC, “Draft Test Model Under Consideration”, JCTVC-A205, JCT-VC Meeting, Dresden, April 2010 (JCT-VC), incorporated by reference herein, likewise does not include a memory bandwidth enforcement mechanism. For robustness, a decoder must be prepared to accept bitstreams which may violate these limits as may be caused by transmission errors damaging a compliant bitstream or a non-conforming encoder. To alleviate such potential limitations the decoder frequently includes additional memory bandwidth, at added expense and complexity, to accommodate the non-compliant bit streams that are provided.

In order to provide a more computationally robust decoder with limited memory bandwidth and/or memory storage requirements, the decoder could be modified in a suitable manner. However, while modifying the decoder to reduce the memory requirements, the corresponding rate distortion performance of the video should not be substantially degraded. Otherwise, while the memory requirements may be reduced, the resulting quality of the video will not be suitable for viewing by the audience. The modification 270 results in a doubling of the coefficient value for every 6 steps in the quantization parameter, and thus may substantially increase the size of the memory requirements. The increased value results in one or more zeros being included as the least significant bits.

Referring to FIG. 3, an exemplary modified de-quantizer 400 receives the quantized coefficient level values 405 and descales the quantized coefficient level values using a descaling process 410, preferably based upon a function of a remainder, transform size, and/or a coefficient index (e.g., position), to determine an intermediate set of values 420. An optional adjustment mechanism C 430 may be applied, which is preferably a variable dependent on transform size (N) or a function of a received quantization parameter (QP), to determine resulting data 440. The resulting data 440 with the maximum predetermined bit depth is modified by a factor of 2^((Period+B)) 460. The results of the modification 460 are provided as de-quantized coefficients 465. Preferably, the adjustment mechanism C 430 used for 8×8 transform coefficients is 2^((5-Period)) and the 2^((Period+B)) 460 is 2^((Period−6)). The process 460 may be based upon, if desired, a function of the transform size (N) or a function of a received quantization parameter (QP). Also, the adjustment mechanism C 430 used for other sized transform coefficients (such as 4×4, 16×16, and 32×32) is preferably zero, and the valued of 2^((Period+B)) 460 is 2^((Period)). Also, B may be a function of N and C may be a function of N. The resulting data 440 from the quantized coefficient level values 405 may include rogue data or otherwise is not compliant, and accordingly the modified de-quantizer 400 may impose a fixed limit on the resulting data 440. The resulting data is preferably clipped 450 to a predetermined bit depth, and thus an N×N block of data is stored in memory within the de-quantizer 400 as de-quantized coefficients 470. For example the clipping 450 for a predetermined bit depth of 16 bits results in any values over 32,767 being set to the maximum value, namely, 32,767. Likewise for a predetermined bit depth of 16 bits results in any values less than −32,768 being set to the minimum value, namely, −32,768. Other bit depths and clipping values may likewise be used. In this manner, the maximum memory bandwidth required is limited by the system, in a manner independent of the input quantized coefficient level values. This reduces the computational complexity of the system and reduces the memory requirements, which is especially suitable for embedded systems.

As illustrated, the aforementioned techniques for limiting the dynamic range of the de-quantizer may include, (1) placing a non-enforceable normative limit on the dynamic range at various points of the de-quantization, inverse transform and/or reconstruction process, and (2) normative clipping of the de-quantized coefficient data produced from the bit-stream prior to the inverse transforms. Both of these techniques attempt to apply a patch to the resulting high dynamic range data prior to it being provided to the inverse transforms, rather than preventing the undesirable high dynamic range data from occurring in the first place. In contrast to applying a patch to the high dynamic range data, it is preferable to limit the syntax of the quantized coefficient level values in the bitstream in such a manner that invalid high dynamic range data does not occur. By placing limits on the bitstream syntax that corresponds to the quantized coefficient level values, high dynamic range constraints may be readily enforced without the need for substantial processing by the decoder and likewise may result in improved video quality. Any quantized coefficient level value which is received that is not within the valid limits may be discarded or detected as an error. An alternate use of these limits is to clip all decoded quantized coefficient level values into the range determined by the bound. This clipping process of level values ensures that the result of the dequantization process is always within the desired limits regardless of the bitstream content. This clipping may be used in conjunction with some limit on the quantized coefficient level values.

The entropy coder may limit the dynamic range of the de-quantized coefficient level values by only including in the bitstream acceptable values, as limited by the syntax of the bitstream. The entropy encoder may use any suitable coder, such as for example, a variable length coder or an arithmetic coder. The encoder provides through the bitstream to the decoder a set of data, including the quantization parameter and the quantized coefficient level values. The decoder along with other data provided, receives the quantization parameter (e.g., QP) and the quantized coefficient level values. The quantization parameter and the quantized coefficient level values should be selected in such a manner, and signaled in the bitstream within permitted ranges in such a manner, to inherently limit the dynamic range following entropy decoding, de-scaling and/or de-quantization. The limits for the entropy coding syntax elements may be derived from such limits.

The bitstream compliance test based on quantized coefficient level values 200 may be carried out at the output of an encoder; or at the input to a decoder; or at both locations and may use the bounds derived using the following process: Referring to FIG. 4, the quantized coefficient level value 200 may be determined by a function f1 and/or f2 and values of quantization parameter 401, dequantized coefficient values 220, and possibly transform block size 403 or more generally transform operator. Given a bound on size of dequantized coefficient values 407, the allowable range of quantized coefficient level values 405 is determined by a function f3 and/or f4 for values of quantization parameter 401 and transform block size 403. The allowable range of dequantized coefficient values can be expressed as a bound on the maximum allowable quantized coefficient level value. The determination of the limits for the bitstream syntax that expresses the quantized coefficient level values may be derived from this limit on quantized coefficient level values. For example, if the desired bound on the size of the de-quantized coefficient values is 15 bits plus a sign bit, then this desired bound may be used to determine the maximum for the selection of quantized coefficient level values in the bitstream depending upon the quantization parameter and transform block size. In many cases it is desirable to permit the encoder to select the quantization parameter in a typical manner, and based upon the selected quantization parameter provide an upper bound for the quantized coefficient level values for the bitstream. In this case, the bitstream is structured such that it does not support quantized coefficient level values that are outside of a valid range determined by analysis of the function f1, f2, f3, and f4. As a result, the bitstream does not support values of the Quantized Coefficients, or quantized coefficients, which exceed the desired size.

Another selection of the bound on the quantized coefficient level values 405 is to use the desired bound on the de-quantized coefficients 407 as a maximum, and select values for the quantization coefficient level values based upon a larger number of parameters. In some cases, it may be desirable to permit the encoder to select the quantization parameter in a typical manner and a transform block size (e.g., N) in a typical manner, and based upon the selected quantization parameter and the block size, provide an upper bound for the quantized coefficient level values for the bitstream. In this case, the bitstream is structured such that it does not support values of Quantized Coefficient Level, or quantized coefficient level value, exceeding the bound derived from QP, N, desired size of Quantized Coefficient and f(QP, N, Quantized Coefficients). In some cases, it may be desirable to permit the encoder to select the quantization parameter in a typical manner, a transform block size in a typical manner and a BitIncrement value in a typical manner, and based upon the selected quantization parameter, the transform block size, and BitIncrement value provide an upper bound for the quantized coefficient level values for the bitstream. In this case, the bitstream is structured such that it does not support values of quantized coefficient level values that are outside of a valid range.

In one particular implementation, it is desirable to determine a suitable relation between the desired bound on the de-quantized coefficients, the quantization parameters (e.g., QP), and the quantized coefficient level values signaled in the bitstream. Using a de-quantization relation of JCTVC-E243, one may determine a relation between the desired bound on the de-quantized coefficient values and a desired bound on the absolute quantized coefficient level values. Alternative de-quantization relationships may likewise be used.

For example, for representation in k signed bits, the de-quantized coefficients may be bounded in absolute value by 2^(k−1)−1, e.g., for 16-signed bits, the absolute de-quantized coefficient level value is limited to 2¹⁵−1, inclusive.

A set of de-quantized coefficient level values may be defined for the determination of the relationship:

B=source bit width (e.g., 8 or 10 bit);

DB=B−8 (internal bit-depth increase with 8-bit input);

N=transform size; Note, in case of non-square transform N represents a 2-tuple vector containing {fd, sd} where fd is the size of the first 1-dimensional inverse transform and sd is the size of the second 1-dimensional inverse transform.

M=log 2(N); Note, in case of non-square transforms M may be a function of sizes of the first and second 1-dimensional inverse transform, for example M=(log 2(fd)+log 2(sd))>>1. Where, x>>y Arithmetic right shift of a two's complement integer representation of x by y binary digits. This function is defined only for positive integer values of y. Bits shifted into the MSBs as a result of the right shift have a value equal to the MSB of x prior to the shift operation.

Q=f(QP %6),

where f(x)={26214,23302,20560,18396,16384,14564}, x=0, . . . , 5

IQ=g(QP %6),

where g(x)={40,45,51,57,64,72}, x=0, . . . , 5

Dequantization which converts a quantized coefficient Level Value, level, and a quantizer parameter QP into a de-quantized coefficient may be given by the following formula: coeffQ=((level*IQ<<(QP/6))+offset)>>(M−1+DB), offset=1<<(M−2+DB).

An alternate dequantization formula may be given by: coeffQ=sgn(level)((|level|*IQ<<(QP/6))+offset)>>(M−1+DB), offset=1<<(M−2+DB) where the function sgn(x) is defined as:

${{sgn}(x)} = \left\{ \begin{matrix} {- 1} & {x < 0} \\ 0 & {x = 0} \\ 1 & {x > 0} \end{matrix} \right.$

When DB=0, this reduces to coeffQ=sgn(level)((|level|*IQ<<(QP/6))+offset)>>(M−1),

The characterization may start with the following relationship: CoefficientB≥([Largest Allowed Quantized Coefficient Level Values*IQ]<<(QP/6)+offset)>>(M−1+DB), where CoefficientB is the bound on the magnitude of de-quantized coefficients; x<<y Arithmetic left shift of a two's complement integer representation of x by y binary digits. This function is defined only for positive integer values of y. Bits shifted into the LSBs as a result of the left shift have a value equal to 0. This relationship is dependent on the de-quantized coefficients, IQ which is a function of the quantization parameter, an offset which depends on the transform size and bit depth, M which is based upon the transform size, and DB which is based upon the source bit width. Thus, the relationship is dependent on the quantization parameter, the de-quantized coefficients, the source bit width, and the transform size. The source bit width may be inherent in the function, depending if more than one bit width is permitted.

The offset shown above accommodates rounding, and the offset may be a non-negative number defined as: 1<<(M−2+DB).

Thus given the desired bound on magnitude of de-quantized coefficient values, the selected bound on quantized coefficient level values may be determined by CoefficientB(N)=[Largest Allowed Quantized Coefficient Level Values*IQ]<<(QP/6)+offset)>>(M−1+DB), where CoefficientB(M) denotes the bound on magnitude of de-quantized coefficient values depending on the transform size N and M=log 2(N).

Solving for the Largest Allowed Quantized Coefficient Level Values, results in the following relationship:

${{Largest}\mspace{14mu}{Allowed}\mspace{14mu}{Quantized}\mspace{14mu}{Coefficient}\mspace{14mu}{Level}\mspace{14mu}{Values}} = {\left( {\left( {{{CoeffiecientB}(N)} ⪡ {\left( {M - 1 + {DB}} \right) - {offset}}} \right) ⪢ \frac{QP}{6}} \right)*{\frac{1}{IQ}.}}$ For determination of a value of LevelBound(QP,N) sufficient to limit the magnitude of dequantized coefficients, this offset is ignored and the bound is slightly reduced by taking the integer part to simply the form of the LevelBound(QP,N) and still achieve the coefficient bound.

The upper bound on the dequantized coefficients and consequently the, quantization coefficient level values, may depend on transform size N and may be expressed as:

${{LevelBound}\left( {{QP},M} \right)} = {\left\lfloor {\frac{{CoeffiecientB}(M)}{IQ} ⪡ \left( {M - 1 + {DB} - \frac{QP}{6}} \right)} \right\rfloor.}$ where LevelBound(QP,M) is the largest allowed quantized coefficient value for quantization parameter QP and transform size N, CoeffBound(M) is the bound on magnitude of de-quantized coefficient values for transform size N and M=log 2(N). The operation [x] denotes the integer floor operation i.e. [2.34]=2.

A negative left shift may be interpreted as a corresponding right shift, where a right shift is defined by removing the least significant bit of a number magnitude that is represented in binary form. Since IQ depends on QP %6, the bound levels may be determined based on the desired de-quantized coefficient value bound (possibly depending on transform block size), QP, and the transform block size (M=log 2(transform block size)).

As described, the relationship defining the de-quantization coefficients and de-quantized coefficient level values may have dependence on the transform block size and the quantization parameter. This provides a system with bounds that may be determined by six values of IQ and a modification based on the transform block size and the quantization parameter. A table structure may be exploited to derive a compact expression for the bounds using a doubling property of the bound as transform block size doubles and similar doubling each time QP is increased by 6 due to the term QP/6. Thus only 6 bounds are independent with the remaining values being determined by QP and/or transform block size changes.

Explicit values may be determined for de-quantized coefficients having an absolute value limited to 15-bits and DB equal to zero. For QP ranging from 0-5 and a transform block size of 4×4, one may have the bounds shown below, with bounds for larger transform block size scaled by an appropriate power of two and similarly bounds for larger QP values scaled by a power of two depending upon QP/6. Modifications for nonzero DB or other de-quantized coefficient values limits may be made. Fractional values may be converted to integers slightly reducing the bound in some cases in the list below:

LevelBound(0:5,5)={13106, 11650, 10279, 9197, 8191, 7281}, where the parameter 5 corresponds to the transform block size of 32 since log 2(32)=5.

A more general relation may be used for the quantized coefficient level value bounds depending on QP, transform block size (N) by M=log 2(N), and the six bounds listed above, such as:

LevelBound(QP, M)=L_(B) [QP %6]>>(M−5+QP/6) where L_(B)(x)={13106, 11650, 10279, 9197, 8191, 7281} for x=0,1,2,3,4,5. In the case of nonzero internal bit-depth increase value DB, an alternate formula may be used: LevelBound (QP,M,B)=(L_(B) [QP %6]<<(B−8))>>(5−M+QP/6) where L_(B)(x)={13106, 11650, 10279, 9197, 8191, 7281} for x=0,1,2,3,4,5. Where QP is the quantization parameter, M is determined from the transform block size N by M=log 2(N) and B is the source bit-depth typically B=8 or B=10. The parameter DB=B−8. When DB=0 this is the same result. In addition, a clipping operation may be performed to limit the largest level allowed in the bitstream to LevelBound. When the dequantization process has an additive offset, this bound on levels may be reduced by to account for the dynamic range increase caused by this additive offset. The offset is typically no more than the size of a quantization bin making a reduction of level bound by 1 sufficient to guarantee the desired dynamic range following dequantiation. A modification of the LevelBound formula may be of the form; LevelBound (QP,M,B)=(L_(B) [QP %6]<<(B−8))>>(5−M+QP/6)−1 where L_(B)(x)={13106, 11650, 10279,9197, 8191, 7281} for x=0,1,2,3,4,5. Where QP is the quantization parameter, M is determined from the transform block size N by M=log 2(N) and B is the source bit-depth typically B=8 or B=10.

This bound on quantized coefficient level values may be used to provide a bound on the appropriate syntax element used for the bitstream syntax. For HEVC arithmetic coding of the JCT-VC standard a relevant syntax element is coeff_abs_level_minus3. The syntax element satisfies the following relation: |transCoeffLevel|=coeff_abs_level_minus3+3.

The bound on the level denoted above determines a bound on the syntax element by subtracting three from the LevelBound defined above to give bounds for QP and transform block size N according to:

${{coeff\_ abs}{\_ level}{\_ minus3Bound}\left( {{QP},N} \right)} = {\left( {{{LevelBound}\left( {{{QP}\mspace{14mu}{\% 6}},2} \right)} ⪡ \left( {{\log_{2}(N)} - 2} \right)} \right) ⪢ {\left( \frac{QP}{6} \right) - 3}}$

With this bound, the quantized coefficient level values will satisfy the bound sufficient to guarantee the de-quantized coefficient values are limited to 16-bits.

For HEVC variable length coding of the JCT-VC standard, a relevant syntax element is level_minus2_and_sign. The relation to the absolute de-quantized coefficient value and the bound on the absolute quantized coefficient level value may be used to determine a bound on this syntax element. This syntax element satisfies that the absolute value of the de-quantized coefficient is equal to (level_minus2_and_sign>>1)+2. Therefore a bound on the absolute quantized coefficient level value determines a bound on level_minus2_and_sign which may be: |transCoeffLevel|=(level_minus2_and_sign>>1)+2.

A bound on the syntax element may be determined from the bound on the quantized coefficient level value given above as:

${{level\_ minus2}{\_ and}{\_ signBound}\left( {{QP},N} \right)} = {{2 \cdot \left( {{{LevelBound}\left( {{{QP}\mspace{14mu}{\% 6}},4} \right)} ⪡ \left( {{\log_{2}(N)} - 2} \right)} \right)} ⪢ {\left( \frac{QP}{6} \right) - 4.}}$

In a system using a quantization matrix where the quantization parameter QP varies per coefficient, the limits may be applied to each element based on the corresponding value of QP. This assumes a quantization matrix is represented by giving a different scalar QP value for each element of a set of de-quantized coefficients and hence each corresponding quantized coefficient level value.

In some embodiments the expressions QP/6 and QP %6 used herein may be replaced by QP/P and QP % P respectively where the value of P may differ from 6. The appropriate level limiting bounds will then have to be recalculated to account for the change.

It is noted that support for fractional bit-shifts may be included. That is when a characterization of A<<B, it also includes the use of the expression A*2^(B) being used. Equivalently when a characterization of A>>B, it also includes the use of the expression A*2^(−B) being used.

Referring to FIG. 5, the decoder may receive the quantized coefficient level values 600, coefficient index 610, bit increment 620, N 630, and/or QP 640. A de-quantizer 650 of any suitable design may be included. The de-quantized coefficients from the de-quantizer 650 may be optionally clipped 660, if desired. The de-quantized coefficients may be stored in memory 670, if desired. An inverse transform 680, such as a pair of 1 dimensional transforms or a 2 dimensional transform, may be used to provide a decoded residue 690.

Referring to FIG. 6, a decoder 700 receives a bitstream 710 containing quantized coefficient level values 720 representative of blocks of video and receives quantization parameters 730 related to blocks of the video. A dequantizer 740 receives the quantized coefficient level values 720 and the quantization parameters 730. The dequantizer 740 dequantizes the quantized coefficient level values 720 based upon both the dequantized coefficient level values 720 and the quantization parameter only if the quantized coefficient level values and the quantization parameters 730 are jointly within a predefined range of acceptable values to limit the dynamic range of the dequantizing. The dequantizer 740 provides dequantized coefficient values 750 to an inverse transform 760 to determine a decoded residue 770. The bitstream 710 may also include transform block size 780 information which is provided to the dequantizer 740 for the dequantization process.

The previous discussion has focused on determining limits on the dequantization process with the goal of using these limits to define illegal values or constrain the syntax support to a desired subset of values only. An additional embodiment is using these limits to enforce clipping of the decoded quantized coefficient level values prior to supplying them to the dequantization process. The dynamic range following dequantization will be limited, which reduces the bit-width needed for the dequantization calculation. This process modifies the traditional quantized level value decoding process to include a clip to a specified range.

Referring to FIG. 7, a decoder may receive a quantization parameter QP 810, a transform size N 820, and quantized coefficient level values 850. A limit for clipping is selected from QP and N to determine a clipping point C 840 using for example the level limits derived as LevelBound(QP,M) above where M=Log 2(N). The quantized coefficient level values are clipped 860 prior to the dequantization process 870. Alternate embodiments may apply the clipping to the absolute value and then apply the sign to the clipped result.

As previously described, limiting the bit depth in particular aspects of the video decoder is useful for reducing the complexity of the decoder. In particular, it is desirable to limit the bit depth in the video decoder in some manner prior to the data being provided to the dequantization process. The JCT-VC, “Transform design for HEVC with 16 bit intermediate data representation”, JCTVC-E243, Mar. 18, 2011 (JCT-VC), incorporated by reference herein, describes a video codec that may be summarized in relevant part as follows:

B source bit width (8 or 10 bits);

DB B−8 (internal bit depth increase with 8 bit input);

N transform size;

M log 2(N);

QP quantization parameter;

IQ g(QP %6), where g(x)={40, 45, 51, 57, 64, 72}, x=0, . . . , 5;

coeffQ ((level*IQ<<(QP/6))+offset)>>(M−1+DB), offset=1<<(M−2+DB);

coeffQ min(32767, max(−32768,coeffQ));

where, in general, IQ is the inverse quantization, coeffQ is the dequantized coefficient level values, and coeffQ is also clipped.

The clipping operation coeffQ min(32767, max(−32768,coeffQ)) limits the dequantized coefficients to 16 bits for the subsequent inverse transform process. In some embodiments, this dequantization process may be extended to support a weighting matrix within the dequantization process, where intermediate values within the dequantization process may exceed 32 bits despite a 16 bit limitation on the dequantized coefficients. In general, the weighting matrix is a set of weights that transform the coefficients in some manner. For example, the high frequency components may be weighted less than the low frequency components by using the weighting matrix. This characteristic was addressed in the document JCT-VC, “BoG report on Quantization”, JCTVC-G1044, Nov. 29, 2011 (JCT-VC), incorporated by reference herein.

The JET-VC, “BoG report on Quantization”, JCTVC-G1044, Nov. 29, 2011 (JCT-VC), described a video codec that may be summarized in relevant part as follows:

B source bit width (8 or 10 bits);

DB B−8 (internal bit depth increase with 8 bit input);

N transform size;

M log 2(N);

QP quantization parameter;

IQ g(QP %6), where g(x)={40, 45, 51, 57, 64, 72}, x=0, . . . , 5;

W dequantization weighting matrix with 8 bit unsigned entries;

where, in general, IQ is the inverse quantization and W is a dequantization weighting matrix.

The inverse quantization may be as follows: iShift=M−1+DB+4; If(iShift>QP/6); coeffQ[i][j]=(level[i][j]*W[i][j]*IQ[QP %6]+offset)>>(iShift−QP/6), offset=1<<(iShift−QP/6−1), with i=0 . . . nW−1, j=0 . . . nH−1; else coeffQ[i][j]=(level[i][j]*W[i][j]*IQ[QP %6])<<(QP/6−iShift).

The inverse quantization process attempts to control the size of shift process by performing a net shift based upon, at least in part, the inverse quantization IQ. However, the resulting net shift tends not to be well controlled. For example, assuming that the level is 16 bits, W[i][j] is 8-bits, and IQ is 7 bits, then with M=2, DB=0, (iShift=5), QP=51, then QP/6−iShift=3; coeffQ is 16+7+8+3 which is 34 bits. Depending on the decoder system this is greater than 32 bits which could result in a processing error

It is desirable to limit input to multiply operations to 16-bits and bound the dynamic range of intermediate values. Different architectures have different desired bounds on intermediate values. A typical CPU for example benefits by limiting intermediates to 32-bits while the value of 32 is not as critical to hardware implementations in FPGA or ASIC. To reduce the amount of dynamic range reduction imposed on the incoming data or otherwise facilitate a larger dynamic range for the data, the allowable quantized coefficient level values should be based upon the quantization parameter, and the transform size if desired. The quantized coefficient level values may be further selected based upon the weighting matrix, such as an 8-bit weighting matrix. The selection of the allowable quantized coefficient level values may be such that the results within the dequantizer is limited to 32 bits for all values of an 8-bit weighting matrix. This limitation, for example, permits implementation of a dequantizer using a 32-bit limitation on intermediate values and the ability clip or otherwise limit the quantized coefficient level data prior to the dequantization to avoid a 32-bit overflow condition. In an implementation that permits a bit range greater then 32 bits, the system may clip the quantized coefficient level data to a 16 bit range (or other value) independent of the quantization parameter and calculate the same result following the final clip to 16-bits.

One method to avoid extreme dynamic range during dequantization is to include a quantization parameter dependent limit on the permitted quantized coefficient level values in or resulting from the coded bitstream. There are several preferred techniques for implementing dequantization when such a limitation is imposed. One such technique to ensure that the dequantizer does not exceed a predefined bit depth, such as 32-bits, is to include quantization parameter dependent clipping limits. Another such technique is to require the use of a 38-bit dequantizer, while implementing a quantization parameter independent clipping limit, such as 16-bits. A further such technique is to require only a 33 bit dequantizer, and use a quantization parameter independent clipping limit of 15 bits along with a switch based on the range of the quantization parameter. All three of these techniques will give identical results following a final clip despite differences in intermediate bit-depth requirements. This allows a dequantizer to select an appropriate implementation based on the resources of a particular architecture.

An exemplary implementation, including a weighting matrix, may be summarized in relevant part as follows:

B source bit width (8 or 10 bits);

DB B−8 (internal bit depth increase with 8 bit input);

N transform size;

M log 2(N);

QP quantization parameter;

IQ g(QP %6), where g(x)={40, 45, 51, 57, 64, 72}, x=0, . . . , 5;

W dequantization weighting matrix with 8 bit unsigned entries;

where, in general, IQ is an inverse quantization and W is a dequantization matrix.

Prior to the inverse quantization the levels may be clipped, if desired, to 16 bits (or another suitable value) according to level=min(32767, max(−32768,level)).

The inverse quantization may be as follows: iShift=M−1+DB+4; coeffQ[i][j]=(level[i][j]*W[i][j]*IQ[QP %6])<<(QP/6)+offset)>>(iShift), offset=1<<(iShift−1), with i=0 . . . nW−1, j=0 . . . nH−1.

After the inverse quantization the levels may be clipped, if desired, to 16 bits (or another suitable value) according to level=min(32767, max(−32768,level)).

The quantized coefficient level values may be limited based upon the following relationship: a bitstream conforming shall not contain data that results in any element level[i][j] that exceeds the range of integer values from −2^(15−QP/6) to 2^(15−QP/6)−1, inclusive.

Referring to FIG. 8, a technique that ensures that the dequantizer does not exceed a predefined bit depth, such as 32-bits, may be by including quantization parameter dependent clipping limits, as illustrated with DB=0. The quantized coefficient level value[i][j] is decoded 900. The level of the quantized coefficient level value (level[i][j]) is clipped to a specified range, such as −2^(15−QP/6) to 2^(15−QP/6)−1, to inclusive 902. The inverse quantization coefficient is calculated, such as coeffQ[i][j]=(level[i][j]*W[i][j]*IQ[QP %6])<<(QP/6)+offset)>>(iShift) 904. Then the inverse quantization coefficient (coeffQ[i][j]) may be clipped to −2¹⁵ to 2¹⁵−1, inclusive 906.

Referring to FIG. 9, a technique that allows the use of a 38 bit intermediate within the dequantizer and 16-bit inputs to the dequantizer is shown which implements a quantiation parameter independent clipping limit of 16 bits. The quantized coefficient level value[i][j] is decoded 910. The level of the quantized coefficient level value (level[i][j]) is clipped to a specified range, such as −2¹⁵ to 2¹⁵−1, inclusive 912. The inverse quantization coefficient is calculated, such as coeffQ[i][j]=(level[i][j]*W[i][j]*IQ[QP %6])<<(QP/6)+offset)>>(iShift) 914. Then the inverse quantization coefficient (coeffQ[i][j]) may be clipped to −2¹⁵ to 2¹⁵−1, inclusive 916.

Referring to FIG. 10, a technique that allows the use of a 33 bit intermediate within the dequantizer 16-bit input to the dequantizer is shown which use a quantization parameter independent clipping limit of 15 bits along with a switch based on the range of the quantization parameter. The quantized coefficient level value[i][j] is decoded 920. The level of the quantized coefficient level value (level[i][j]) is clipped to a specified range, such as −2¹⁵ to 2¹⁵−1, inclusive 922. The inverse quantization coefficient (coeffQ[i][j]) is calculated 924, such as; If(iShift>QP/6); coeffQ[i][j]=(level[i][j]*W[i][j]*IQ[QP %6]+offset)>>(iShift−QP/6), offset=1<<(iShift−QP/6−1), with i=0 . . . nW−1, j=0 . . . nH−1; else; coeffQ[i][j]=(level[i][j]*W[i][j]*IQ[QP %6])<<(QP/6−iShift).

Then the inverse quantization coefficient (coeffQ[i][j]) may be clipped to −2¹⁵ to 2¹⁵−1, inclusive 926.

In each of these three embodiments, the multiplication of W[i][j] and IQ[QP %6] may be computed prior to multiplying by the level[i][j] value so that only a 16 bit multiplier is used. As a general matter, the worse case arthmetric logic unit requirements in the three embodiments may be computed as shown below nothing that the level is clipped in each during the second step, that W is 8=bits unsigned, and IQ is at most 7 bits unsigned. The term QP/6 has a value no more than 8 in the QP range of 0-51. The IQ value may not use the full 7 bit value thus allowing one to ignore the addition of the offset.

FIG. 8 embodiment: (16−QP/6)+8+7+QP/6=31

FIG. 9 embodiment: 16+8+6+8=38

-   -   Note that when QP/6 assumes the value of 8, IQ takes only 6         bits.

FIG. 10 embodiment: 16+8+6+8−5=33

-   -   Note that large DR occurs when QP=51 and iShift=5 so the else         case occurs with IQ=64. These three embodiments calculate the         exact same value despite use of different resources.

Another embodiment includes the use of the clipping process of the embodiment shown in FIG. 8 to impose a limitation regardless of the particular implementation.

Referring to FIG. 11, one implementation includes receiving the quantized coefficient level values 930 which are limited to 16−QP/6 bits in the bitstream (provided by the encoder). The quantized coefficient level values 910 may be clipped to a predefined bit level by a clipping process 932, such as 16 bits. The clipped data 932 may be dequantized by a dequantization process 934, based upon the quantization parameter, the block size, and/or the weighting matrix. The dequantized data 934 may be clipped by a clipping process 936, such as 16 bits, to provide dequantized coefficients 938.

A different method to control the dynamic range during dequantization is to use clipping prior to the dequantization process rather than rely solely upon limitations place on the input to the dequantizer which may or may not hold due to noncompliant encoding or transmission errors.

Referring to FIG. 12, one implementation includes receiving the quantized coefficient level values 950, which are not necessarily limited to 16−QP/6 bits in the bitstream. The quantized coefficient level values 940 may be clipped to a predefined bit level based upon the quantization parameter QP by a clipping process 942, such as 16−QP/6 bits. The clipped data 942 may be dequantized by a dequantization process 944, based upon the quantization parameter, the block size, and/or the weighting matrix. The dequantized data 944 may be clipped by a clipping process 946, such as 16 bits, to provide dequantized coefficients 948.

Referring to FIG. 13, another implementation includes receiving the quantized coefficient level values 950, which are not necessarily limited to 16−QP/6 bits in the bitstream. The quantized coefficient level values 950 may be clipped to a level L 952. The level L may be a computed clip limit 953 that is based upon the quantization parameter QP and/or block size M. The clipped data 952 may be dequantized by a dequantization process 954, based upon the quantization parameter, the block size, and/or the weighting matrix. The dequantized data 954 may be clipped by a clipping process 956, such as 16 bits, to provide dequantized coefficients 958. By way of example, the clipping limit L may be defined as L=min(15,12+M) and clipping is to the range (−2^(L), 2^(L)−1) i.e. L signed-bits. By way of another example, the clipping limit L may be defined as L=min(15,21+M−QP/6) and clipping is to the range (−2^(L), 2^(L)−1) i.e. L signed-bits.

The terms and expressions which have been employed in the foregoing specification are used therein as terms of description and not of limitation, and there is no intention, in the use of such terms and expressions, of excluding equivalents of the features shown and described or portions thereof, it being recognized that the scope of the invention is defined and limited only by the claims which follow. 

I claim:
 1. A decoder that decodes video comprising: (a) said decoder receives a bitstream containing quantized coefficient level values representative of a block of video representative of a plurality of pixels and a quantization parameter related to said block of video; (b) a de-quantizer of said decoder de-quantizing said quantized coefficient level values based upon said quantized coefficient level values, a transform block size, and said quantization parameter when said quantized coefficient level values, said transform block size, and said quantization parameters are jointly within a predefined range of acceptable values to limit a dynamic range of said dequantizing; (c) said decoder inverse transforming said dequantized coefficients to determine a decoded residue; (d) where the bitstream provided to said de-quantizer includes a restriction on the largest permitted level value allowed in the bitstream and the restriction is selected from among a plurality of different restrictions available to the decoder.
 2. The decoder of claim 1 wherein said quantized coefficient level values provided to said de-quantizer are clipped to a predefined range. 